<template>
    <div>
      <a-modal
        title="选择预算项目3"
        :visible="visible"
        width="70%"
        :maskClosable="false"
        :confirm-loading="confirmLoading"
        @ok="handleOk"
        @cancel="handleCancel"
      >
      <commpVxeTable
        :key="reCommpVxeTable"
        :adaptiveHeight="true"
        :isCanWrap="true"
        :config="dataTableConfig"
        :columns="columnsVxe"
        :formItem="formItem"
        ref="administrativeOffice"
        @searchEvent="searchEvent"
        @resetEvent="resetEvent"
        @radioChange="checkboxChange"
        >
      </commpVxeTable>
      </a-modal>
    </div>
</template>
<script>
import assessCheckApi from './service/api.js'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
export default {
    components:{
        commpVxeTable
    },
    props: {},
    data() {
        return {
            visible: false,
            confirmLoading: false,
            reCommpVxeTable: '',
            dataTableConfig: {
                api: assessCheckApi.xmyslist,
                rowId: 'id',
                urlType: true,
                paramet:{
                    sfcxbbm: ''
                }
            },
            formItem: [
                {
                    label: '预算项目名称',
                    model: 'fysxmmc',
                },
            ],
            columnsVxe: [
                {
                    type: 'radio',
                    width: 60,
                    fixed: 'left'
                },{
                    title: '部门',
                    field: 'fbm',
                },{
                    title: '预算项目名称',
                    field: 'fysxmmc',
                },{
                    title: '总指标',
                    field: 'fzzb',
                },{
                    title: '指标结余',
                    field: 'fzbjy',
                },
            ],
            valData: {}
        }
    },
    methods: {
        handleOk(e) {
            this.confirmLoading = true;
            this.visible = false;
            this.confirmLoading = false;
            this.$emit('getSelectionValue',this.valData)
            this.reCommpVxeTable = Date.now()
        },
        handleCancel(e) {
            //console.log('Clicked cancel button');
            this.visible = false;
        },
        // 勾选
        checkboxChange(val){
            //console.log(val.newValue)
            this.valData = val.newValue
        },
        // 搜索
        searchEvent(){
            this.dataTableConfig.paramet = {
                ...this.dataTableConfig.paramet,
            }
            //console.log(this.dataTableConfig.paramet)
        },
        // 重置
        resetEvent(){
            this.dataTableConfig.paramet = {
                ...this.dataTableConfig.paramet,
            }
        },
    },
}
</script>
